package com.pinyoumei.app.adapter;

import android.support.annotation.Nullable;
import android.support.v4.content.ContextCompat;
import android.view.View;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.pinyoumei.app.R;
import com.pinyoumei.app.bean.SignDataBean;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.util.List;

/**
 * Created by Administrator on 2021-08-09.
 * --------- 日期 ------- 维护人 ------------ 变更内容 --------
 * 2021-08-09        Administrator             新增Person类
 * 2021-08-09        Administrator             增加sex属性
 */
public class SignInAdapter extends BaseQuickAdapter<SignDataBean, BaseViewHolder> {
    public SignInAdapter(int layoutResId, @Nullable List<SignDataBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, SignDataBean item) {
        TextView tv_code  =helper.getView(R.id.tv_code);
        RelativeLayout rl_bg  =helper.getView(R.id.rl_bg);
        tv_code.setText(item.getSign_day_str());


        View view = helper.getView(R.id.v_1);

        if (item.isAfter()){
            tv_code.setTextColor(ContextCompat.getColor(mContext,R.color.sign_color));
        }else{
            tv_code.setTextColor(ContextCompat.getColor(mContext,R.color.loan_select_text_color));
        }



        if (item.isSign()){
            view.setVisibility(View.VISIBLE);
        }else{
            view.setVisibility(View.INVISIBLE);
        }

        if (item.isDate_bg()){
            rl_bg.setBackground(ContextCompat.getDrawable(mContext,R.drawable.shanpe_red_oval));
            tv_code.setTextColor(ContextCompat.getColor(mContext,R.color.white));
        }else{
            rl_bg.setBackground(null);
        }

    }
}
